package com.cjg.javaBasics;

public class Student {
    String name;
    private int age;

    public int getAge(){
        return age;
    }
    public void setAge(int age){
        if (age<0 || age>120){
            System.out.println("非法");
        }else
        this.age=age;
    }






    public void st(){
        System.out.println(this.name);
    }


    //new的初始化必须要
    public Student(){

    }
    // 初始化传参 alt+insert 快捷生成有参无参
    public Student(String name){

        this.name=name;
    }
}
